package com.platform.modules.wallet.utils;

import org.jasypt.util.text.BasicTextEncryptor;

public class EncryptUtil {
    public static void urlAndUsernameAndPassword(String url,String username,String password) {
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        // 加密秘钥(盐)
        textEncryptor.setPassword("anquanjiami");
        // 要加密的数据（数据库的用户名或密码）
        String username1 = textEncryptor.encrypt(username);
        String password1 = textEncryptor.encrypt(password);
        String url1= textEncryptor.encrypt(url);
        System.out.println("url:"+url1);
        System.out.println("username:" + username1);
        System.out.println("password:" + password1);
        String decrypt = textEncryptor.decrypt("vxOsUDHifv4nTkEkeLnrWRoatJc5La0cVjFgPd3O6rMYXLXxSR61yRJVBNMZRzrIGCpD+6f/QRZvjtJmIQS0W+9RWlBTukHB6HNWVxlXuwJDF/LZLfxJDS5YyLlVdWM0tIBIICRt50AuNY+HT7wZ9ULS9nsCq8HZ8jZW72EdKC+ybZ/PQ1GOJvJ0kVvQVgz8YMLO3jOeJ3hoXtP9oFdb/W2D8zbigKshVVq+cfasmrznTqma4uJ2vJ/hS79X28W6dg/XpkjjRY0YWfPVAx/GrPmAPij0XhEw");
        System.out.println(decrypt);

    }

    public static void main(String[] args) {
        //生成密文
        EncryptUtil.urlAndUsernameAndPassword(
                "jdbc:mysql://121.4.99.38:3306/boot-im?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&verifyServerCertificate=false&serverTimezone=GMT%2B8&allowMultiQueries=true",
                "root",
                "7688550");

    }
}
